﻿@model IEnumerable<Forest.Cat.Web.Models.WantAdModel>  
<ul class="clearfix">
    @foreach (var ad in Model) {
        var isNew = false;
        var maxLength = 17;

        if (!string.IsNullOrWhiteSpace(ad.TextStyle) && ad.TextStyle.Contains("bold")) {
            maxLength -= 1;
        }

        if (ad.StartDate.HasValue && ad.StartDate.Value.Date.AddDays(2).CompareTo(DateTime.Now.Date) >= 0) {
            isNew = true;
            maxLength -= 2;
        }       
       
        <li><a href="@ad.NavigatorUrl" target="_blank" style="@ad.TextStyle" title="@ad.Text">
            @(ad.Text.Length > maxLength ? ad.Text.Substring(0, maxLength - 1) + "…" : ad.Text)
        </a>
            @if (isNew) { 
                <img src="/Themes/DarkOrange/Content/images/new03.gif" alt="" />
            }
        </li>
    }
</ul>
